
module.exports = {
  // 自定义分割 vendor
  chainWebpack: config => {
    config.optimization.splitChunks({
      chunks: 'all',
      minSize: 10000,
      maxSize: 0,
      minChunks: 2,
      maxAsyncRequests: 5,
      maxInitialRequests: 3,
      automaticNameDelimiter: '~',
      name: true,
      cacheGroups: {
        vendor: {
          name: 'vendor',
          chunks: 'all',
          test: /[\\/]node_modules[\\/]/,
          priority: 10,
          enforce: true
        }
      }
    });
  }
};